package com.xhx.componet;

import org.apache.logging.log4j.core.util.UuidUtil;
import org.springframework.stereotype.Component;

import com.xhx.context.FlowContext;
import com.xhx.vo.ApplyFlowVO;
import com.yomahub.liteflow.core.NodeComponent;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component("validCmp")
public class ValidCmp extends NodeComponent {
    @Override
    public void process() throws Exception {
        ApplyFlowVO param = this.getSlot().getRequestData();

        FlowContext context = this.getContextBean(FlowContext.class);
        context.setAmount(param.getAmount());
        context.setDiscount(param.getDiscount());
        context.setFlowId(UuidUtil.getTimeBasedUuid().toString());
        context.setName(param.getName());
        context.setType(param.getType());
        log.info("context:{}", context);
    }

}
